home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
c_lib.arc
/
FLRETATR.C
< prev
next >
Wrap
Text File
|
1990-08-09
|
2KB
|
61 lines
/**
*
* Name flretatr -- Return file attribute
*
* Synopsis ercode = flretatr(pfile,pattrib);
* int ercode Returned DOS function error code
* char *pfile File path name
* int pattrib Returned file attribute
*
* Description This function returns the file attribute of the specified
* file. See FLCREATE for the possible attributes.
*
* Returns ercode DOS 2.0 function return error code
* pattrib File attribute. If an error is encountered
* -1 is returned.
*
* Version 1.0 (C)Copyright Blaise Computing Inc. 1983
*
**/
#include <compiler.h>
struct dreg
{
unsigned ax,bx,cx,dx,si,di,ds,es;
};
#define DOSREG struct dreg
int flretatr(pfile,pattrib)
char *pfile;
int *pattrib;
{
DOSREG dos_reg;
int ercode,utinit(),dos();
#if CI201A & LDATA
unsigned long ptrtoabs();
#endif
utinit(&dos_reg); /* Initialize registers */
dos_reg.ax = 0x4300; /* Function 43, return attribute*/
#if LDATA
#if CI201A
dos_reg.ds = (unsigned)((ptrtoabs(pfile) & 0xffff0L) >> 4L);
dos_reg.dx = (unsigned)(ptrtoabs(pfile) & 0xfL);
#else
dos_reg.ds = (unsigned)(((long)(pfile) & 0xffff0L) >> 4L);
dos_reg.dx = (unsigned)((long)(pfile) & 0xfL);
#endif
#else
dos_reg.dx = (unsigned)pfile;
#endif
ercode = dos(&dos_reg);
if (ercode == 0)
*pattrib = (int)dos_reg.cx;
else
*pattrib = -1;
return(ercode);
}